<?php
/*
 * @Author: your name
 * @Date: 2020-11-17 10:33:13
 * @LastEditTime: 2020-12-17 10:35:47
 * @LastEditors: Please set LastEditors
 * @Description: 规则日志验证器
 * @FilePath: /special/application/adminapiv3/validate/RuleLogValidate.php
 */
namespace app\adminapiv3\validate;

use think\Validate;

class RuleLogValidate extends Validate
{
    protected $rule = [
        //规则id
        'id|日志ID' => 'require|number|length:1,8',
        //主机id
        'host_id|主机ID' => 'require|number|length:1,8',
        //创建时间
        'create_time|创建时间' => 'number|length:10,11',
        //特征码
        'signature_code|特征码' => 'require|alphaNum|length:1,40',
        //错误码
        'error_code|错误码' => 'number|length:1,8',
        //错误信息
        'error_message|错误信息' => 'chsAlphaNum|length:1,255',
    ];

    protected $scene = [
        //日志列表
        // 'list' => ['host_id','signature_code','error_code'],
        //回滚操作
        'reset' => ['id','host_id','create_time','signature_code'],
        //详情
        'info' => ['id','host_id']
    ];

    public function sceneList ()
    {
        return $this->only(['host_id','signature_code','error_code'])->remove('signature_code', 'require');
    }
}

